// item selection
$('.file-box').click(function () {
  $(this).toggleClass('selected');
  if ($('.file-box.selected').length == 0)
    $('.select').removeClass('selected');
  else
    $('.select').addClass('selected');
  counter();
});

// all item selection
$('.select').click(function () {
  if ($('.file-box.selected').length == 0) {
    $('.file-box').addClass('selected');
    $('.select').addClass('selected');
  }
  else { 
    $('.file-box').removeClass('selected');
    $('.select').removeClass('selected');
  }
  counter();
});

// number of selected items
function counter() {
  if ($('.file-box.selected').length > 0)
    $('.send').addClass('selected');
  else
    $('.send').removeClass('selected');
  $('.send').attr('data-counter',$('li.selected').length);
}


var rem=new Array(); 
function shift_select(){  
   
    $(".file-box").click(function (e){  
        
        if(e.shiftKey){  
            rem.push($(".file-box").index($(this)));
            var upOne = rem[rem.length-2];
            var clazzVal = $(this).attr("class");
            var iMin =  Math.min(rem[rem.length-2],rem[rem.length-1])  
            var iMax =  Math.max(rem[rem.length-2],rem[rem.length-1])  
            for(i=iMin;i<=iMax;i++){  
                $(".file-box:eq("+i+") ").addClass("selected") ;  
                //这边部分为逻辑代码，你可以根据需要来处理全中的div  
               //$(".box div:eq("+i+")")这为选中的div  
            }  
        }else{  
            //$(this).toggleClass("selected");  
        }  
    });  
}  
$(function(){  
    shift_select();  
});  
document.onselectstrat=function(event){   //避免文字被选中  
    event = window.event||event;  
    event.returnValue = false;  
}